home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
jabber
/
JabberContact.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
4KB
|
94 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
from common.actions import ActionMeta
import jabber
import common.actions as common
from common.actions import action
import contacts
from util import callsback
import logging
log = logging.getLogger('jabber.contact')
contact_attrs = ('watched', 'buddy_changed', '__repr__', 'group', 'buddy', 'remove_from_group')
no_widget = lambda self, *a, **k: None if getattr(self.buddy, 'iswidget', False) else True
cgetattr = contacts.Contact.__getattribute__
objget = object.__getattribute__
class JabberContact(common.actions.ActionType, contacts.Contact):
inherited_actions = [
jabber.jbuddy]
__metaclass__ = ActionMeta
def __init__(self, buddy, group):
self.group = group
contacts.Contact.__init__(self, buddy, buddy.id)
def send_sms(self):
raise TypeError('Jabber does not support SMS at this time')
send_sms = action((lambda self: pass))(send_sms)
def remove(self, callback = None):
if len(self.buddy.groups) <= 1:
return self.buddy.remove(callback = callback)
else:
return self.remove_from_group(callback = callback)
remove = action(no_widget)(callsback(remove))
def rename_gui(self):
return contacts.Contact.rename_gui(self)
rename_gui = action(no_widget)(rename_gui)
def remove_from_group(self, callback = None):
log.info('remove_from_group %s: %s', self.group, self)
item = self.protocol.roster.get_item_by_jid(self.id).clone()
item.groups.remove(self.group)
query = item.make_roster_push()
self.protocol.send_cb(query, callback = callback)
remove_from_group = callsback(remove_from_group)
def replace_group(self, new_group, callback = None):
item = self.protocol.roster.get_item_by_jid(self.id).clone()
if self.group is not None:
item.groups.remove(self.group)
if new_group not in item.groups:
item.groups.append(new_group)
query = item.make_roster_push()
self.protocol.send_cb(query, callback = callback)
replace_group = callsback(replace_group)
def view_past_chats(self, *a, **k):
self.buddy.view_past_chats(*a, **k)
view_past_chats = action(no_widget)(view_past_chats)
def __iter__(self):
return iter(self.buddy)
def __getattr__(self, attr):
if attr in contact_attrs:
return cgetattr(self, attr)
else:
return getattr(cgetattr(self, 'buddy'), attr)
def __repr__(self):
return '<JabberContact %s>' % self.buddy.name
def block(self):
pass
block = action((lambda self: pass))(block)
unblock = block